﻿using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using XNAGuiLib.GuiLibResourceManager;
using Microsoft.Xna.Framework;

namespace XNAGuiLib.Core.Data
{
    public sealed class Text
    {
        #region Public Field - Value
        private string _value = null;
        /// <summary>
        /// gets or sets the value of the Text Objects
        /// </summary>
        public string Value
        {
            get
            {
                return _value;
            }
            set
            {
                _value = value;
            }
        }
        #endregion

        #region Public Field - Font
        private SpriteFont _font = null;
        /// <summary>
        /// gets or sets the Font to use on this textpart.
        /// </summary>
        public SpriteFont Font
        {
            get
            {
                return _font;
            }
            set
            {
                _font = value;
            }
        }
        #endregion 

        #region Public Field - TextColor
        private Color _textColor = Color.Black;
        /// <summary>
        /// gets or sets the Color to use for this textpart
        /// </summary>
        public Color TextColor
        {
            get
            {
                return _textColor;
            }
            set
            {
                _textColor = value;
            }
        }
        #endregion



        #region Constructor - Text(string value)
        /// <summary>
        /// Creates a Text object which uses the given string as it's value
        /// </summary>
        /// <param name="value">the string value which will be drawn later on.</param>
        public Text(string value)
        {
            _value = value;
        }
        #endregion 

        #region Constructor - Text(string value, SpriteFont font)
        /// <summary>
        /// Creates a Text object which uses the given string as it's value
        /// </summary>
        /// <param name="value">the string value which will be drawn later on.</param>
        /// <param name="font">the SpriteFont used for the text rendering.</param>
        public Text(string value, SpriteFont font)
        {
            _value = value;

            _font = font;
        }
        #endregion 

        #region Constructor - Text(string value, SpriteFont font, Color textColor)
        /// <summary>
        /// Creates a Text object which uses the given string as it's value
        /// </summary>
        /// <param name="value">the string value which will be drawn later on.</param>
        /// <param name="font">the SpriteFont used for the text rendering.</param>
        /// <param name="textColor">the Color in which the text will be drawn to the screen.</param>
        public Text(string value, SpriteFont font, Color textColor)
        {
            _value = value;

            _font = font;

            _textColor = textColor;
        }
        #endregion 


        public int Width()
        {
            return (int)_font.MeasureString(_value).X;
        }

        public int Heigth()
        {
            return (int)_font.MeasureString(_value).Y;
        }
    }
}